<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <h3>父组件</h3>
        <p>obj.msg:{{ obj.msg }}</p>
        <input type="text" v-model="obj.msg">
        <hr>
        <comp-a :obj="obj"></comp-a>
    </div>
    <template id="tempa">
        <div>
            <h3>子组件</h3>
            <p>obj.msg:{{ obj.msg }}</p>
            <input type="text" v-model="obj.msg">
        </div>
    </template>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            obj: {
                msg: "父组件msg"
            }
        },
        components: {
            CompA: {
                template: "#tempa",
                props: ["obj"]
            }
        }
    });
</script>

</html>